package com.wgc.canal.listener;

import com.wgc.canal.config.RabbitConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class RabbitMqListener {
    @Autowired
    private RestTemplate restTemplate;
    @RabbitListener(queues = RabbitConfig.RABBIT_QUEUE)
    public void listener(Object message){
        System.out.println(message);
        String forObject = restTemplate.getForObject("http://192.168.79.128/ad_load", String.class);
        System.out.println(forObject);

    }
    @RabbitListener(queues = RabbitConfig.RABBIT_QUEUE)
    public void listener1(Object message){
        System.out.println(message);
        String forObject = restTemplate.getForObject("http://192.168.79.128/ad_load", String.class);
        System.out.println(forObject);
    }

}
